package ui.client;

import java.util.ArrayList;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * the interface of ChatService defines the operation
 * of chat through gwt rpc
 * @author wangkaidi
 *
 */
public interface ChatServiceAsync {

	/**
	 * try to login to the system.	 * 
	 * @param username 
	 * @param password
	 * @return the login result,if success,it will return "true"
	 * else it will return "false"
	 */
	public void login(String protocolname,String username,String password,String domail,String host,int port, AsyncCallback<String> callback);
	
	/**
	 * logout the system
	 */
	public void disconnect(AsyncCallback<?> callback);
	
	/**
	 * send a message to a specific user.
	 * message's from attribute must be the user itself
	 * @param message
	 * @return. if the send operation success,it will return "true"
	 * else it will return "false"
	 */
	public void send(InstantMessage message, AsyncCallback<String> callback);
	
	/**
	 * receive a list of Message.
	 * if there is no message,this method will
	 * block
	 * @return
	 */
	public void receive(AsyncCallback<ArrayList<InstantMessage>> callback);
	
	/**
	 * get a group Arraylist of friends
	 * @return
	 */
	public void getGroups(AsyncCallback<ArrayList<Group>> callback);
	
	/**
	 * this method will receive a list
	 * of UserPresence change.
	 * it will be blocked ,until there is
	 * reply
	 * @return
	 */
	public void presenceChange(AsyncCallback<ArrayList<UserPresence>> callback);
	

}
